package com.simple.microservices.web.active;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.simple.microservices.api.active.BlindBoxService;
import com.simple.microservices.commons.utils.Response;
import com.simple.microservices.dao.dataobject.MineSpot;
import com.simple.microservices.web.auth.dto.MySpotDTO;
import com.simple.microservices.web.convert.AuthConvert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.List;

/**
 * @author hyf
 * @date 2021/10/11
 */
@Controller
@RequestMapping("/active/miss/mineSpot")
public class MineSpotController {

    @Autowired
    private BlindBoxService blindBoxService;

    @GetMapping("page")
    @ResponseBody
    public Response mineSpotPage(@Validated MySpotDTO mySpotDTO){


        IPage<MineSpot> list = blindBoxService.getPageList(AuthConvert.INSTANCE.convert(mySpotDTO));
        return Response.success(list);
    }

    @GetMapping("all")
    @ResponseBody
    public Response mineSpotList(){
        List<MineSpot> list = blindBoxService.getAllList();
        return Response.success(list);
    }

}